
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
  <meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
  <div id="container" style="height: 100%"></div>

  <script type="text/javascript" src="./echarts.min.js"></script>
  <script type="text/javascript">
    var dom = document.getElementById('container');
    var myChart = echarts.init(dom, null, {
      renderer: 'canvas',
      useDirtyRect: false
    });
    var app = {};
    var option;
    option = {
  series: [
    {
      min: 0,
      max: 2000,
      type: 'gauge',
      axisLine: {
        lineStyle: {
          width: 10,
          color: [
          [0.2, '#1fab89'],
            [0.4, '#95e1d3'],
            [0.6, '#3490de'],
            [0.8, '#6639a6'],
            [1, '#ea5455']
          ]
        }
      },
      pointer: {
        itemStyle: {
          color: 'inherit'
        }
      },
      axisTick: {
        distance: -30,
        length: 8,
        lineStyle: {
          color: '#fff',
          width: 1
        }
      },
      splitLine: {
        distance: -30,
        length: 30,
        lineStyle: {
          color: '#fff',
          width: 1
        }
      },
      axisLabel: {
        color: 'inherit',
        distance: 12,
        fontSize: 8
      },
      detail: {
        fontSize: 18,
        valueAnimation: true,
        formatter: '{value}',
        color: 'inherit'
      },
      data: [
        {
          value: 70
        }
      ]
    }
  ]
};

function toAndroidCall(value){
  myChart.setOption({
    series: [
      {
        data: [
          {
            value: value
          }
        ]
      }
    ]
  });


};



// setInterval(function () {
//   myChart.setOption({
//     series: [
//       {
//         data: [
//           {
//             value: +(Math.random() * 100).toFixed(2)
//           }
//         ]
//       }
//     ]
//   });
// }, 2000);

    if (option && typeof option === 'object') {
      myChart.setOption(option);
    }

    window.addEventListener('resize', myChart.resize);
  </script>
</body>
</html>